package com.xiaoshuidi.cloud.module.bpm.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum MaintenanceFlagEnum {

    ROOM("房间", 2),
    PUBLIC("公区", 1);

    private String name;
    private Integer value;

    public static String getNameByValue(Integer value){
        MaintenanceFlagEnum maintenanceFlagEnum = Arrays.stream(MaintenanceFlagEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if(ObjectUtil.isEmpty(maintenanceFlagEnum)){
            return "";
        }
        return maintenanceFlagEnum.getName();
    }
}
